﻿using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.Linq;
using System.IO;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
using System.Windows.Forms;
using Tibia;
using Tibia.Objects;
using Tibia.Util;
using Tibia.Constants;
using ComponentFactory.Krypton.Toolkit;
using System.Collections.Generic;


namespace LothusBot
{
    public partial class frmPrinc : ComponentFactory.Krypton.Toolkit.KryptonForm
    {
		//Developed by Augusto Vasconcelos - http://www.TibiaBots.Net
        #region Variaveis Globais

        public Client c;
        public Player p;
        NotifyIcon NIcon = new NotifyIcon();

        //Forms
        Forms.CaveBot f = new Forms.CaveBot();
        Forms.About a = new Forms.About();

        #region Funções

        string hp(string hp)
        {
            if (hp == "HP")
            {
                hp = "266";
            }
            else
            {
                if (hp == "SHP")
                {
                    hp = "236";
                }
                else
                {
                    if (hp == "GHP")
                    {
                        hp = "239";
                    }
                    else
                    {
                        if (hp == "GSP")
                        {
                            hp = "7642";
                        }
                        else
                        {
                            hp = "7643";
                        }
                    }
                }
            }
            return (hp);
        }

        string mp(string mp)
        {
            if (mp == "MP")
            {
                mp = "268";
            }
            else
            {
                if (mp == "SMP")
                {
                    mp = "237";
                }
                else
                {
                    mp = "238";
                }
            }
            return (mp);
        }

        string rune(string rune)
        {
            if (rune == "IH")
            {
                rune = Convert.ToString(Items.Rune.IntenseHealing.Id);
            }
            else
            {
                if (rune == "UH")
                {
                    rune = Convert.ToString(Items.Rune.UltimateHealing.Id);
                }
            }
            return (rune);
        }

        bool ShowHideBotHotkey()
        {
            if (c.Window.IsActive)
            {
                if (c.Window.Title == "Tibia - Press F12 to show the bot")
                    c.Window.Title = "Tibia";
                return false;
            }
            return true;
        }

        private void MostraIcone()
        {
            NIcon.Icon = this.Icon;
            NIcon.Visible = true;
            NIcon.Text = p.Name;
            NIcon.ContextMenuStrip = contextMenuStrip1;
            this.Hide();
        }

        private void EscondeIcone()
        {
            NIcon.Visible = false;
            this.Show();
        }

        private void DoSplash()
        {
            Splash sp = new Splash();
            sp.ShowDialog();
        }

        #endregion

        public frmPrinc()
        {
            InitializeComponent();
            Thread th = new Thread(new ThreadStart(DoSplash));
            th.Start();
            Thread.Sleep(3000);
            th.Abort();
            Thread.Sleep(1000);
        }

        #endregion

        #region Principal (Verificações)

        private void Form1_Load(object sender, EventArgs e)
        {
            Process[] processo = Process.GetProcessesByName("tibia");
            if (processo.Length > 0)
            {
                c = ClientChooser.ShowBox();
                if (c != null)
                {
                    if (c.LoggedIn)
                    {
                        p = c.GetPlayer();
                        picbox_heal1.Hide();
                        picbox_heal2.Hide();
                        timer_img.Start();
                        timer_exp.Start();
                    }
                    else
                    {
                        MessageBox.Show("Nenhum char logado!", "Nenhum char logado!",
                            MessageBoxButtons.OK, MessageBoxIcon.Error);
                        Environment.Exit(0);
                    }
                }
                else
                {
                    MessageBox.Show("Nenhum char logado!", "Nenhum char logado!",
                        MessageBoxButtons.OK, MessageBoxIcon.Error);
                    Environment.Exit(0);
                }
            }
            else
            {
                MessageBox.Show("Tibia não esta aberto!", "Tibia não encontrado!",
                        MessageBoxButtons.OK, MessageBoxIcon.Error);
                Environment.Exit(0);
            }
        }

        #endregion

        #region Hacks

        private void bt_Luz_On_Click(object sender, EventArgs e)
        {
            c.Map.FullLightOn();
        }

        private void bt_Luz_Off_Click(object sender, EventArgs e)
        {
            c.Map.FullLightOff();
        }

        #endregion

        #region CheckBoxs

        //auto-eat
        private void chk_food_CheckedChanged(object sender, EventArgs e)
        {
            if (tb_time_food.Text.Trim() != "")
            {
                if (chk_food.Checked == true)
                {
                    timer_food.Start();
                    tb_time_food.Enabled = false;
                }
                else
                {
                    timer_food.Stop();
                    timer_food.Interval = 1000;
                    tb_time_food.Enabled = true;
                }
            }
            else
            {
                if (chk_food.Checked == true)
                {
                    MessageBox.Show("Digite um valor acima de 0.");
                    chk_food.Checked = false;
                }
            }
        }

        //anti-idle
        private void checkBox1_CheckedChanged(object sender, EventArgs e)
        {
            if (chk_idle.Checked == true)
            {
                timer_idle.Start();
            }
            else
            {
                timer_idle.Stop();
                timer_idle.Interval = 1000;
            }
        }

        //Heals
        private void chk_heal1_CheckedChanged(object sender, EventArgs e)
        {
            if (chk_heal1.Checked != false)
            {
                if (tb_heal1.Text.Trim() == "")
                {
                    MessageBox.Show("Digite a porcentagem da life!");
                    chk_heal1.Checked = false;
                }
                else
                {
                    if (tb_heal_sp1.Text.Trim() == "")
                    {
                        MessageBox.Show("Digite a magia a ser usada!");
                        chk_heal1.Checked = false;
                    }
                    else
                    {
                        if (chk_heal1.Checked == true)
                        {
                            timer_heal_spell.Start();
                            tb_heal1.Enabled = false;
                            tb_heal_sp1.Enabled = false;
                        }
                    }
                }
            }
            else
            {
                timer_heal_spell.Stop();
                tb_heal1.Enabled = true;
                tb_heal_sp1.Enabled = true;
            }

        }

        private void chk_heal2_CheckedChanged(object sender, EventArgs e)
        {
            if (chk_heal2.Checked != false)
            {
                if (tb_heal2.Text.Trim() == "")
                {
                    MessageBox.Show("Digite a porcentagem da life!");
                    chk_heal2.Checked = false;
                }
                else
                {
                    if (tb_heal_sp2.Text.Trim() == "")
                    {
                        MessageBox.Show("Digite a magia a ser usada!");
                        chk_heal2.Checked = false;
                    }
                    else
                    {
                        if (chk_heal2.Checked == true)
                        {
                            timer_heal_spell2.Start();
                            tb_heal2.Enabled = false;
                            tb_heal_sp2.Enabled = false;
                        }
                    }
                }
            }
            else
            {
                timer_heal_spell2.Stop();
                tb_heal2.Enabled = true;
                tb_heal_sp2.Enabled = true;
            }
        }

        //Mana
        private void chk_mp1_CheckedChanged(object sender, EventArgs e)
        {
            if (chk_mp1.Checked != false)
            {
                if (tb_mana1.Text.Trim() == "")
                {
                    MessageBox.Show("Digite a quantidade de mana!");
                    chk_mp1.Checked = false;
                }
                else
                {
                    if (tb_mspell1.Text.Trim() == "")
                    {
                        MessageBox.Show("Digite a magia a ser usada!");
                        chk_mp1.Checked = false;
                    }
                    else
                    {
                        if (chk_mp1.Checked == true)
                        {
                            timer_mana_train1.Start();
                            tb_mana1.Enabled = false;
                            tb_mspell1.Enabled = false;
                        }
                    }
                }
            }
            else
            {
                timer_mana_train1.Stop();
                tb_mana1.Enabled = true;
                tb_mspell1.Enabled = true;
            }
        }

        private void chk_mp2_CheckedChanged(object sender, EventArgs e)
        {
            if (chk_mp2.Checked != false)
            {
                if (tb_mana2.Text.Trim() == "")
                {
                    MessageBox.Show("Digite a quantidade de mana!");
                    chk_mp2.Checked = false;
                }
                else
                {
                    if (tb_mspell2.Text.Trim() == "")
                    {
                        MessageBox.Show("Digite a magia a ser usada!");
                        chk_mp2.Checked = false;
                    }
                    else
                    {
                        if (chk_mp2.Checked == true)
                        {
                            timer_mana_train2.Start();
                            tb_mana2.Enabled = false;
                            tb_mspell2.Enabled = false;
                        }
                    }
                }
            }
            else
            {
                timer_mana_train2.Stop();
                tb_mana2.Enabled = true;
                tb_mspell2.Enabled = true;
            }
        }

        //Potions
        //HP
        private void chk_pot1_CheckedChanged(object sender, EventArgs e)
        {
            if (chk_pot1.Checked != false)
            {
                if (tb_heal3.Text.Trim() == "")
                {
                    MessageBox.Show("Digite a porcentagem da life!");
                    chk_pot1.Checked = false;
                }
                else
                {
                    if (cb_pot1.Text.Trim() == "")
                    {
                        MessageBox.Show("Selecione a potion a ser usada!");
                        chk_pot1.Checked = false;
                    }
                    else
                    {
                        if (chk_pot1.Checked == true)
                        {
                            timer_hp1.Start();
                            tb_heal3.Enabled = false;
                            cb_pot1.Enabled = false;
                        }
                    }
                }
            }
            else
            {
                timer_hp1.Stop();
                tb_heal3.Enabled = true;
                cb_pot1.Enabled = true;
            }
        }

        private void chk_pot2_CheckedChanged(object sender, EventArgs e)
        {
            if (chk_pot2.Checked != false)
            {
                if (tb_heal4.Text.Trim() == "")
                {
                    MessageBox.Show("Digite a porcentagem da life!");
                    chk_pot2.Checked = false;
                }
                else
                {
                    if (cb_pot2.Text.Trim() == "")
                    {
                        MessageBox.Show("Selecione a potion a ser usada!");
                        chk_pot2.Checked = false;
                    }
                    else
                    {
                        if (chk_pot2.Checked == true)
                        {
                            timer_hp2.Start();
                            tb_heal4.Enabled = false;
                            cb_pot2.Enabled = false;
                        }
                    }
                }
            }
            else
            {
                timer_hp2.Stop();
                tb_heal4.Enabled = true;
                cb_pot2.Enabled = true;
            }
        }

        //MP
        private void chk_mp3_CheckedChanged(object sender, EventArgs e)
        {
            if (chk_mp3.Checked != false)
            {
                if (tb_mana3.Text.Trim() == "")
                {
                    MessageBox.Show("Digite a porcentagem da mana!");
                    chk_mp3.Checked = false;
                }
                else
                {
                    if (cb_mpot1.Text.Trim() == "")
                    {
                        MessageBox.Show("Selecione a potion a ser usada!");
                        chk_mp3.Checked = false;
                    }
                    else
                    {
                        if (chk_mp3.Checked == true)
                        {
                            timer_mp1.Start();
                            tb_mana3.Enabled = false;
                            cb_mpot1.Enabled = false;
                        }

                    }
                }
            }
            else
            {
                timer_mp1.Stop();
                tb_mana3.Enabled = true;
                cb_mpot1.Enabled = true;
            }
        }

        private void chk_mp4_CheckedChanged(object sender, EventArgs e)
        {
            if (chk_mp4.Checked != false)
            {
                if (tb_mana3.Text.Trim() == "")
                {
                    MessageBox.Show("Digite a porcentagem da mana!");
                    chk_mp4.Checked = false;
                }
                else
                {
                    if (cb_mpot2.Text.Trim() == "")
                    {
                        MessageBox.Show("Selecione a potion a ser usada!");
                        chk_mp4.Checked = false;
                    }
                    else
                    {
                        if (chk_mp4.Checked == true)
                        {
                            timer_mp2.Start();
                            tb_mana4.Enabled = false;
                            cb_mpot2.Enabled = false;
                        }
                    }
                }
            }
            else
            {
                timer_mp2.Stop();
                tb_mana4.Enabled = true;
                cb_mpot2.Enabled = true;
            }
        }

        //Rune Heal and RuneMaker
        private void chk_runeheal_CheckedChanged(object sender, EventArgs e)
        {
            if (chk_runeheal.Checked != false)
            {
                if (tb_healrune.Text.Trim() == "")
                {
                    MessageBox.Show("Digite a porcentagem da life!");
                    chk_runeheal.Checked = false;
                }
                else
                {
                    if (cb_runeheal.Text.Trim() == "")
                    {
                        MessageBox.Show("Selecione a runa a ser usada!");
                        chk_runeheal.Checked = false;
                    }
                    else
                    {
                        if (chk_runeheal.Checked == true)
                        {
                            timer_rune.Start();
                            tb_healrune.Enabled = false;
                            cb_runeheal.Enabled = false;
                        }
                    }
                }
            }
            else
            {
                timer_rune.Stop();
                tb_healrune.Enabled = true;
                cb_runeheal.Enabled = true;
            }
        }

        private void chk_runemaker_CheckedChanged(object sender, EventArgs e)
        {
            if (chk_runemaker.Checked)
            {
                if (tb_soul.Text.Trim() != "")
                {
                    if (tb_ManaMaker.Text.Trim() != "")
                    {
                        if (tb_RuneMaker.Text.Trim() != "")
                        {
                            timer_runemaker.Start();
                            tb_soul.Enabled = false;
                            tb_ManaMaker.Enabled = false;
                            tb_RuneMaker.Enabled = false;
                        }
                        else
                        {
                            MessageBox.Show("Digite a magia a ser usada para runar!");
                            chk_runemaker.Checked = false;
                        }
                    }
                    else
                    {
                        MessageBox.Show("Digite a quantidade minima para runar!");
                        chk_runemaker.Checked = false;
                    }
                }
                else
                {
                    MessageBox.Show("Digite o Soul que a runa gasta!");
                    chk_runemaker.Checked = false;
                }
            }
            else
            {
                tb_soul.Enabled = true;
                tb_ManaMaker.Enabled = true;
                tb_RuneMaker.Enabled = true;
                timer_runemaker.Stop();
                chk_runemaker.Checked = false;
            }
        }

        //Autos
        private void chk_utamo_CheckedChanged(object sender, EventArgs e)
        {
            if (chk_utamo.Checked != false)
            {
                timer_utamo.Start();
            }
            else
            {
                timer_utamo.Stop();
            }
        }

        private void chk_hur_CheckedChanged(object sender, EventArgs e)
        {
            if (chk_hur.Checked)
            {
                timer_hur.Start();
                radio_hur.Enabled = false;
                radio_ghur.Enabled = false;
            }
            else
            {
                timer_hur.Stop();
                radio_hur.Enabled = true;
                radio_ghur.Enabled = true;
            }
        }

        private void chk_invis_CheckedChanged(object sender, EventArgs e)
        {
            if (chk_invis.Checked)
            {
                timer_invis.Start();
            }
            else
            {
                timer_invis.Stop();
            }
        }

        private void chk_poison_CheckedChanged(object sender, EventArgs e)
        {
            if (chk_poison.Checked)
            {
                timer_poison.Start();
            }
            else
            {
                timer_poison.Stop();
            }
        }

        private void chk_paralyze_CheckedChanged(object sender, EventArgs e)
        {
            if (chk_paralyze.Checked)
            {
                timer_paralyze.Start();
            }
            else
            {
                timer_paralyze.Stop();
            }
        }

        private void chk_fish_CheckedChanged(object sender, EventArgs e)
        {
            if (chk_fish.Checked)
            {
                chk_fishcap.Enabled = false;
                num_cap.Enabled = false;
                timer_fish.Start();
            }
            else
            {
                chk_fishcap.Enabled = true;
                num_cap.Enabled = true;
                timer_fish.Stop();
            }
        }

        #endregion

        #region Labels (Avisos)

        private void label3_Click(object sender, EventArgs e)
        {
            MessageBox.Show("Para escolher o tempo que o char irá\n"
                        + "se mover, basta selecionar de quantos\n"
                        + "em quantos minutos o char irá se mover!");
        }

        private void label18_Click(object sender, EventArgs e)
        {
            MessageBox.Show("Cuidado ao utilizar este auto-eat...\n"
                           + "ele irá comer qualquer food encontrado\n"
                           + "dentro de sua backpack!");
        }

        #endregion

        #region Timers

        //Timers de Heal

        private void timer_heal_spell_Tick(object sender, EventArgs e)
        {
            double vida = Convert.ToDouble(p.HealthMax);
            double porcent = Convert.ToDouble(tb_heal1.Text) / 100;
            if (p.Health < porcent * vida)
            {
                c.Console.Say(tb_heal_sp1.Text);
            }
        }

        private void timer_heal_spell2_Tick(object sender, EventArgs e)
        {
            double vida2 = Convert.ToDouble(p.HealthMax);
            double porcent2 = Convert.ToDouble(tb_heal2.Text) / 100;
            if (p.Health < porcent2 * vida2)
            {
                c.Console.Say(tb_heal_sp2.Text);
            }
        }

        //Timers de Mana

        private void timer_mana_train1_Tick(object sender, EventArgs e)
        {
            if (p.Mana >= Convert.ToDouble(tb_mana1.Text))
            {
                c.Console.Say(tb_mspell1.Text);
            }
        }

        private void timer_mana_train2_Tick(object sender, EventArgs e)
        {
            if (p.Mana >= Convert.ToDouble(tb_mana2.Text))
            {
                c.Console.Say(tb_mspell2.Text);
            }
        }

        //Timers de Potions
        //HP
        private void timer_hp1_Tick(object sender, EventArgs e)
        {
            double vida = Convert.ToDouble(p.HealthMax);
            double porcent = Convert.ToDouble(tb_heal3.Text) / 100;
            uint potion = Convert.ToUInt32(hp(cb_pot1.Text));
            if (p.Health < porcent * vida)
            {
                foreach (Item i in c.Inventory.GetItems())
                {
                    if (i.Id == potion)
                    {
                        i.UseOnSelf();
                    }
                }
            }
        }

        private void timer_hp2_Tick(object sender, EventArgs e)
        {
            double vida = Convert.ToDouble(p.HealthMax);
            double porcent = Convert.ToDouble(tb_heal4.Text) / 100;
            uint potion = Convert.ToUInt32(hp(cb_pot2.Text));
            if (p.Health < porcent * vida)
            {
                foreach (Item i in c.Inventory.GetItems())
                {
                    if (i.Id == potion)
                    {
                        i.UseOnSelf();
                    }
                }
            }
        }
        //MP
        private void timer_mp1_Tick(object sender, EventArgs e)
        {
            double mana = Convert.ToDouble(p.ManaMax);
            double porcent = Convert.ToDouble(tb_mana3.Text) / 100;
            uint potion = Convert.ToUInt32(mp(cb_mpot1.Text));
            if (p.Mana < porcent * mana)
            {
                foreach (Item i in c.Inventory.GetItems())
                {
                    if (i.Id == potion)
                    {
                        i.UseOnSelf();
                    }
                }
            }
        }

        private void timer_mp2_Tick(object sender, EventArgs e)
        {
            double mana = Convert.ToDouble(p.ManaMax);
            double porcent = Convert.ToDouble(tb_mana4.Text) / 100;
            uint potion = Convert.ToUInt32(mp(cb_mpot2.Text));
            if (p.Mana < porcent * mana)
            {
                foreach (Item i in c.Inventory.GetItems())
                {
                    if (i.Id == potion)
                    {
                        i.UseOnSelf();
                    }
                }
            }
        }

        //Timers Variados
        private void timer_idle_Tick(object sender, EventArgs e)
        {
            Decimal min = numericUpDown1.Value;
            timer_idle.Interval = Convert.ToInt32(min) * 60000;

            Random rand = new Random();
            p.Turn((Direction)rand.Next(3));
        }

        private void timer_food_Tick(object sender, EventArgs e)
        {
            timer_food.Interval = 1000 * Convert.ToInt32(tb_time_food.Text);
            Item food = c.Inventory.GetItems().FirstOrDefault(i => Tibia.Constants.ItemLists.Foods.ContainsKey(i.Id));
            if (food != null)
            {
                food.Use();
            }
            else
            {
                MessageBox.Show("Não tem food na BP ou " +
                            "ela não esta aberta!");
                chk_food.Checked = false;
            }
        }

        private void timer_img_Tick(object sender, EventArgs e)
        {
            if (cb_runeheal.Text != "")
            {
                if (cb_runeheal.Text == "IH")
                {
                    picbox_heal1.Show();
                    picbox_heal2.Hide();
                }
                else
                {
                    if (cb_runeheal.Text == "UH")
                    {
                        picbox_heal1.Hide();
                        picbox_heal2.Show();
                    }
                }
            }
            else
            {
                picbox_heal1.Hide();
                picbox_heal2.Hide();
            }
        }

        private void timer_exp_Tick(object sender, EventArgs e)
        {
            ulong exp;
            exp = ((((17 + ((p.Level + 1) - 6) * (p.Level + 1)) / 3 * (p.Level + 1) - 4) * 50) - p.Experience);
            lb_exp.Text = "Experience for lvl " + (p.Level + 1) + ":\n" + exp.ToString();

            string name = p.Name;
            lb_nome.Text = name;

            string world = p.WorldName;
            lb_world.Text = "World Name: " + world;

            Location lugar = p.Location;
            string location;
            location = lugar.ToString();
            lb_location.Text = "Location " + location;
        }

        //Autos
        private void timer_hur_Tick(object sender, EventArgs e)
        {
            if (radio_ghur.Checked)
            {
                if (p.Mana > 100 && p.HasFlag(Flag.Hasted) == false)
                {
                    c.Console.Say("utani gran hur");
                }
            }
            else
            {
                if (radio_hur.Checked)
                {
                    if (p.Mana > 60 && p.HasFlag(Flag.Hasted) == false)
                    {
                        c.Console.Say("utani hur");
                    }
                }
            }
        }

        private void timer_invis_Tick(object sender, EventArgs e)
        {
            if (p.Mana > 440)
            {
                c.Console.Say("utana vid");
            }
        }

        private void timer_poison_Tick(object sender, EventArgs e)
        {
            if (p.Mana > 30 && p.HasFlag(Flag.Poisoned) == true)
            {
                c.Console.Say("exana pox");
            }
        }

        private void timer_paralyze_Tick(object sender, EventArgs e)
        {
            if (p.Mana > 60 && p.HasFlag(Flag.Paralyzed) == true)
            {
                c.Console.Say("utani hur");
            }
        }

        private void timer_utamo_Tick(object sender, EventArgs e)
        {
            if (p.Mana > 40 && p.HasFlag(Flag.ProtectedByManaShield) == false)
            {
                c.Console.Say("utamo vita");
            }
        }

        private void timer_rune_Tick(object sender, EventArgs e)
        {
            double vida = Convert.ToDouble(p.HealthMax);
            double porcent = Convert.ToDouble(tb_healrune.Text) / 100;
            uint runeid = Convert.ToUInt32(rune(cb_runeheal.Text));
            if (p.Health < porcent * vida)
            {
                foreach (Item i in c.Inventory.GetItems())
                {
                    if (i.Id == runeid)
                    {
                        i.UseOnSelf();
                    }
                }
            }
        }

        private void timer_fish_Tick(object sender, EventArgs e)
        {
            uint cap = p.Capacity;
            cap = cap / 100;
            Random random = new Random();
            List<Tile> fishes = c.Map.GetTilesOnSameFloor().Where(tile => Tibia.Constants.Tiles.Water.GetFishIds().Contains(tile.Ground.Id)).ToList();
            if (chk_fishcap.Checked)
            {
                if (num_cap.Value >= 1)
                {
                    if (cap > Convert.ToInt32(num_cap.Value))
                    {
                        if (fishes.Count > 0)
                        {
                            c.Inventory.UseItemOnTile(Tibia.Constants.Items.Tool.FishingRod.Id, fishes[random.Next(fishes.Count - 1)]);
                        }
                    }
                    else
                    {
                        timer_fish.Stop();
                        chk_fishcap.Enabled = true;
                        num_cap.Enabled = true;
                        chk_fish.Checked = false;
                    }
                }
                else
                {
                    timer_fish.Stop();
                    chk_fishcap.Enabled = true;
                    num_cap.Enabled = true;
                    chk_fish.Checked = false;
                    MessageBox.Show("Valor da Cap esta =< 0.");
                }
            }
            else
            {
                if (fishes.Count > 0)
                {
                    c.Inventory.UseItemOnTile(Tibia.Constants.Items.Tool.FishingRod.Id, fishes[random.Next(fishes.Count - 1)]);
                }
            }

        }

        //RuneMaker
        private void timer_runemaker_Tick(object sender, EventArgs e)
        {
            Item blank = c.Inventory.GetItems().FirstOrDefault(i => i.Id == Tibia.Constants.Items.Rune.Blank.Id);
            uint mana = Convert.ToUInt32(tb_ManaMaker.Text);
            uint soul = Convert.ToUInt32(tb_soul.Text);
            tb_blank.Text = blank.Count.ToString();

            if (p.Mana >= mana && p.Soul > soul)
            {
                if (blank.Count >= 0)
                {
                    Thread.Sleep(1000);
                    c.Console.Say(tb_RuneMaker.Text);
                }
            }
        }

        #endregion

        #region Botões

        private void restaurarToolStripMenuItem_Click(object sender, EventArgs e)
        {
            EscondeIcone();
        }

        private void minimizeToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.Size = new Size(140, 55);
        }

        private void showToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.Size = new Size(380, 280);
        }

        private void trayToolStripMenuItem_Click(object sender, EventArgs e)
        {
            MostraIcone();
        }

        private void exitToolStripMenuItem_Click(object sender, EventArgs e)
        {
            EscondeIcone();
            Application.Exit();
        }

        private void bt_CaveBot_Click(object sender, EventArgs e)
        {
            MostraIcone();
            f.ShowDialog();
        }

        private void aboutToolStripMenuItem_Click(object sender, EventArgs e)
        {
            a.ShowDialog();
        }

        #endregion

    }
}
